home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Games Collection 1 / software vault.zip / software vault / CDR10 / XLIB06.ZIP / XLIB.INC < prev    next >
Text File  |  1993-10-05  |  5KB  |  167 lines

  1. ;-----------------------------------------------------------------------
  2. ;
  3. ; XLIB - Include file
  4. ;
  5. ; Global equates and variables
  6. ;
  7. ;
  8. ; ****** XLIB - Mode X graphics library                ****************
  9. ; ******                                               ****************
  10. ; ****** Written By Themie Gouthas                     ****************
  11. ;
  12. ; egg@dstos3.dsto.gov.au
  13. ; teg@bart.dsto.gov.au
  14. ;
  15. ; MODIFICATIONS:
  16. ;  26-9-92 :       Pel panning code added
  17. ;  23-10-92:       Added clip rectangle code
  18. ;-----------------------------------------------------------------------
  19.  
  20. ;
  21.  
  22. LOCALS
  23. .286
  24.  
  25. ; First lets find out what memory model to use
  26.  
  27. include model.inc
  28.  
  29.  
  30. AC_INDEX        equ  03c0h   ;Attribute controller index register
  31. MISC_OUTPUT     equ  03c2h   ;Miscellaneous Output register
  32. SC_INDEX        equ  03c4h   ;Sequence Controller Index
  33. GC_INDEX        equ  03ceh   ; Graphics controller Index
  34. CRTC_INDEX      equ  03d4h   ;CRT Controller Index
  35. DAC_READ_INDEX  equ  03c7h   ;
  36. DAC_WRITE_INDEX equ  03c8h   ;
  37. DAC_DATA        equ  03c9h   ;
  38. INPUT_STATUS_0 equ   03dah   ;Input status 0 register
  39.  
  40.  
  41. SCREEN_SEG    equ    0a000h  ;segment of display memory in mode X
  42.  
  43. MAP_MASK      equ    02h     ;index in SC of Map Mask register
  44. READ_MAP      equ    04h     ;index in GC of the Read Map register
  45. BIT_MASK      equ    08h     ;index in GC of Bit Mask register
  46.  
  47. OVERFLOW      equ    07h     ; CRTC overflow register index
  48. MAX_SCAN_LINE equ    09h     ; CRTC maximum scan line register index
  49. ADDR_HIGH     equ    0ch     ;Index of Start Address High reg in CRTC
  50. ADDR_LOW      equ    0dh     ;                       Low
  51. CRTC_OFFSET   equ    13h     ; CRTC offset register index
  52. UNDERLINE     equ    14h     ; CRTC underline location register index
  53. MODE_CONTROL  equ    17h     ; CRTC mode control register index
  54. LINE_COMPARE  equ    18h     ; CRTC line compare reg. index (bits 0-7 of
  55.                  ; split screen scan line
  56.  
  57. AC_MODE_CONTROL equ    10h   ; Index of Mode COntrol register in AC
  58. PEL_PANNING     equ    13h   ; Pel panning register index in AC
  59.  
  60. PATTERN_BUFFER equ 0fffch    ;offset in screen memory of pattern buffer
  61.  
  62. TRUE    equ 1
  63. FALSE   equ 0
  64.  
  65.  
  66. OK             equ 0
  67. ERROR          equ 1
  68.  
  69.  
  70. ;-----------------------------------------------------------------------
  71. ; Macro to wait for the vertical retrace leading edge
  72.  
  73. WaitVsyncStart   macro
  74.     LOCAL WaitNotVsync,WaitVsync
  75.     mov     dx,INPUT_STATUS_0
  76. WaitNotVsync:
  77.     in      al,dx
  78.     test    al,08h
  79.     jnz     WaitNotVsync
  80. WaitVsync:
  81.     in      al,dx
  82.     test    al,08h
  83.     jz      WaitVsync
  84.     endm
  85.  
  86. ;-----------------------------------------------------------------------
  87. ; Macro to wait for the vertical retrace trailing edge
  88.  
  89. WaitVsyncEnd    macro
  90.     LOCAL WaitNotVsync,WaitVsync
  91.     mov     dx,INPUT_STATUS_0
  92. WaitVsync2:
  93.     in      al,dx
  94.     test    al,08h
  95.     jz      WaitVsync2
  96. WaitNotVsync2:
  97.     in      al,dx
  98.     test    al,08h
  99.     jnz     WaitNotVsync2
  100.     endm
  101.  
  102. ;--- Word out macro ------------------------------------------
  103.  
  104.      WORDOUT  macro
  105.      IFDEF nw
  106.        out  dx,al
  107.        inc  dx
  108.        xchg al,ah
  109.        out  dx,al
  110.        xchg al,ah
  111.        dec  dx
  112.      ELSE
  113.        out  dx,al
  114.      ENDIF
  115.      endm
  116.  
  117. ;------------------------------------------------------------------------
  118. ; Global variables - XMAIN exports
  119. ;
  120.     global _InGraphics              :byte
  121.     global _CurrXMode               :word
  122.     global _ScrnPhysicalByteWidth   :word
  123.     global _ScrnPhysicalPixelWidth  :word
  124.     global _ScrnPhysicalHeight      :word
  125.     global _ErrorValue              :byte
  126.  
  127.     global _SplitScrnOffs           :word
  128.     global _SplitScrnScanLine       :word
  129.     global _SplitScrnVisibleHeight  :word
  130.     global _Page0_Offs              :word
  131.     global _Page1_Offs              :word
  132.     global _Page2_Offs              :word
  133.     global _ScrnLogicalByteWidth    :word
  134.     global _ScrnLogicalPixelWidth   :word
  135.     global _ScrnLogicalHeight       :word
  136.  
  137.     global _MaxScrollX              :word
  138.     global _MaxScrollY              :word
  139.     global _DoubleBufferActive      :word
  140.     global _TrippleBufferActive     :word
  141.     global _VisiblePageIdx          :word
  142.     global _VisiblePageOffs         :word
  143.     global _HiddenPageOffs          :word
  144.     global _WaitingPageOffs         :word
  145.     global _NonVisual_Offs          :word
  146.     global _TopClip                 :word
  147.     global _BottomClip              :word
  148.     global _LeftClip                :word
  149.     global _RightClip               :word
  150.  
  151.         global _PhysicalStartByteX      :word
  152.     global _PhysicalStartPixelX     :word
  153.     global _PhysicalStartY          :word
  154.  
  155.     global _VsyncHandlerActive      :word
  156.     global _MouseRefreshFlag        :word
  157.     global _MouseVsyncHandler       :dword
  158.     global _StartAddressFlag        :word
  159.     global _WaitingStartLow         :word
  160.     global _WaitingStartHigh        :word
  161.     global _WaitingPelPan           :word
  162.     global _VsyncPaletteStart       :word
  163.     global _VsyncPaletteCount       :word
  164.     global _VsyncPaletteBuffer      :byte
  165.  
  166.  
  167.